package com.base.library.view.systemPhotoAlbum;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * 作者：王东一 on 2016/5/31 13:04
 **/
public class PhotoFragmentAdapter extends FragmentPagerAdapter {
    private Context mContext;
    private ArrayList<String> tab_status = new ArrayList<String>();
    private ArrayList<PhotoInfoFragment> fragments;

    public PhotoFragmentAdapter(FragmentManager fm, Context mContext, ArrayList<PhotoInfoFragment> fragments) {
        super(fm);
        this.mContext = mContext;
        this.fragments = fragments;
        tab_status.add("图片标题");
    }


    @Override
    public CharSequence getPageTitle(int position) {
        return tab_status.get(position);
    }

    @Override
    public Fragment getItem(int arg0) {
        Fragment fragment = null;
        if (arg0 < fragments.size())
            fragment = fragments.get(arg0);
        else
            fragment = fragments.get(0);

        return fragment;
    }

    @Override
    public int getCount() {
        return tab_status.size();
    }

}
